package sist.dao;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import sist.bean.AdminMemberBean;
import sist.bean.CompanyBean;

@Component
public class CompanyDao extends SqlSessionDaoSupport implements MyBatisDao{

	@Autowired
	protected void initDao(SqlSessionTemplate sqlSessionTemplate) throws Exception {
		// TODO Auto-generated method stub
		super.setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	public void insertCompany(CompanyBean bean)throws Throwable{
		this.getSqlSession().insert("sist.dao.company.insertCompany", bean);
	}

	@Override
	public List<CompanyBean> selectCompany(CompanyBean bean) throws Throwable {
		// TODO Auto-generated method stub
		return this.getSqlSession().selectList("sist.dao.company.selectCompany",bean);
	}

	@Override
	public CompanyBean selectCompanyInfo(int no) throws Throwable {
		// TODO Auto-generated method stub
		return this.getSqlSession().selectOne("sist.dao.company.selectCompanyInfo", no);
	}

	@Override
	public void updateCompany(CompanyBean bean) throws Throwable {
		// TODO Auto-generated method stub
		this.getSqlSession().update("sist.dao.company.updateCompany", bean);
	}

	@Override
	public void deleteCompany(int no) throws Throwable {
		// TODO Auto-generated method stub
		this.getSqlSession().delete("sist.dao.company.deleteCompany", no);
	}

	@Override
	public AdminMemberBean adminLogin(AdminMemberBean bean) throws Throwable {
		// TODO Auto-generated method stub
		return this.getSqlSession().selectOne("sist.dao.company.adminLogin", bean);
	}
	
	
}
